import pygame
import os
os.chdir(os.path.dirname(os.path.realpath(__file__)))

# 障碍物
class Obstacle(pygame.sprite.Sprite):
    def __init__(self):
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.image.load("image/obstacle.png")
        self.image = pygame.transform.scale(self.image, (20, 20))
        self.rect = self.image.get_rect()
    
    def draw(self, screen):
        screen.blit(self.image, self.rect)  # 为什么self.rect != self.image.get_rect()